/**
 * Copyright 2015-2016 eyaomall.cn
 * All rights reserved.
 *
 * @project
 * @author jackey
 * @version 1.0
 * @date 2016-01-06
 */
package com.eyaomall.wxmall.dao;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.eyaomall.wxmall.model.po.Stores;
import com.lycheeframework.core.annotation.NameSpace;
import com.lycheeframework.core.support.DaoSupport;

@Repository
@NameSpace("stores")
public class StoresDao extends DaoSupport<Stores> {
	/**
	 * 根据ID查询门店信息
	 */
	public Stores queryById(Integer id){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", id);
		return (Stores) super.query("queryById", map);
	}
	/**
	 * 删除门店
	 */
	public boolean delete(Integer id){
		Stores s = new Stores();
		s.setId(id);
		s.setIsDeleted("y");
		return super.update(s)>0 ? true : false;
	}
	/**
	 * 新增门店
	 */
	public int create(Stores stores){
		super.insert(stores);
		return stores.getId();
	}
	
	/**
	 * 修改
	 * @return
	 */
	public boolean update(Stores stores){
		
		return super.update(stores) > 0 ? true : false;
	}
}